Skip to content

Add warning for rules mixing positional and named references - #776

Merged
ydah merged 1 commit into
ruby:masterfrom
ydah:add-new-warning
Sep 4, 2026
Merged

Add warning for rules mixing positional and named references#776
ydah merged 1 commit into
ruby:masterfrom
ydah:add-new-warning

Conversation

@ydah

@ydah ydah commented Feb 27, 2026

Copy link
Copy Markdown
Member

Add a new MixedReferences warning that detects rules where positional references and named references are used together in the same rule's semantic actions.

No warning (positional references only)

expr: NUM NUM
    {
      $$ = $1 + $2;
    }
    ;

Warnings

expr[result]: NUM[left] NUM[right]
    {
      $result = $1 + $right;
    }
    ;

also warning:

expr[result]: NUM
    {
      $1;
    }
    NUM[right]
    {
      $result = $right;
    }
    ;

@ydah
ydah force-pushed the add-new-warning branch 2 times, most recently from 964477b to c589cf0 Compare February 27, 2026 11:22
@ydah
ydah merged commit 9102510 into ruby:master Sep 4, 2026
23 checks passed
@ydah
ydah deleted the add-new-warning branch September 4, 2026 22:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant